<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
>

<!-- 导入公有的header -->
<head th:include="common/head::header"/>


<body class="hold-transition skin-blue sidebar-mini">
    <!-- =============================================== -->
    <!-- Main content -->
    <section class="content">

        <div class="row">
            <!-- left column -->
            <div class="col-md-6">
                <!-- general form elements -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">文件浏览配置</h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form id="form_file" onsubmit="return false">
                        <div class="box-body">
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="file_is_delete_file" th:checked="${file_is_delete_file=='on'}"> 删除文件功能开启/禁用
                                </label>
                            </div>
                            <div class="form-group">
                                <label>删除文件默认动作</label>
                                <select class="form-control" name="file_delete_action">
                                    <option value="1" th:selected="${file_delete_action==null || file_delete_action=='1'}">移动回收站</option>
                                    <option value="2" th:selected="${file_delete_action=='0'}">物理删除（无法还原）</option>
                                </select>
                            </div>
                            <!-- Select multiple-->
                            <div class="form-group">
                                <label>文件浏览的格式配置</label>
                                <select class="form-control" name="file_view_ext_type">
                                    <option value="0"  th:selected="${file_view_ext_type==null || file_view_ext_type=='0'}">展示所有格式的文件</option>
                                    <option value="1" th:selected="${file_view_ext_type=='1'}">展示音视频文件</option>
                                    <option value="2" th:selected="${file_view_ext_type=='2'}">展示仅视频文件</option>
                                    <option value="3" th:selected="${file_view_ext_type=='3'}">展示仅音频文件</option>
                                    <option value="4" th:selected="${file_view_ext_type=='4'}">展示办公文件格式</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label >视频文件格式扩展名集合（逗号隔开）</label>
                                <textarea class="form-control" name="file_view_ext_video"
                                          th:text="${(file_view_ext_video==null||file_view_ext_video=='')?'mkv,rmvb,mp4':file_view_ext_video}"
                                          style="font-size:16px"
                                          placeholder="多个已分号隔开"></textarea>
                            </div>
                            <div class="form-group">
                                <label >音频文件格式扩展名集合</label>
                                <textarea class="form-control" name="file_view_ext_audio"
                                          th:text="${(file_view_ext_audio==null||file_view_ext_audio=='')?'mp3,ape,flac,wav':file_view_ext_audio}"
                                          placeholder="多个已分号隔开"></textarea>
                            </div>
                            <div class="form-group">
                                <label >办公文件格式扩展名集合</label>
                                <textarea class="form-control" name="file_view_ext_office"
                                          th:text="${(file_view_ext_office==null||file_view_ext_office=='')?'doc,docx,ppt,pptx,xls,xlsx,pdf,txt':file_view_ext_office }"
                                          placeholder="多个已分号隔开"></textarea>
                            </div>
                            <div class="form-group">
                                <label >文件浏览默认打开目录</label>
                                <input type="text" class="form-control" name="file_view_default_root_dir"
                                       th:value="${(file_view_default_root_dir==null||file_view_default_root_dir=='')?default_userHomePath:file_view_default_root_dir}" placeholder="">

                            </div>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="file_view_save_last_dir" th:checked="${file_view_save_last_dir=='on'}"> 自动记住最后一次访问的目录
                                </label>
                            </div>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="file_view_save_dir_log" th:checked="${file_view_save_dir_log=='on'}"> 记录目录访问日志
                                </label>
                            </div>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="file_view_analysis_action" th:checked="${file_view_analysis_action=='on'}"> 分析近期访问行为
                                </label>
                            </div>
                            <div class="form-group">
                                <label>展示文件列表包含隐藏文件</label>
                                <select class="form-control" name="file_view_hidden_file">
                                    <option value="1" th:selected="${file_view_hidden_file==null || file_view_hidden_file=='1'}">排除隐藏文件</option>
                                    <option value="0" th:selected="${file_view_hidden_file=='0'}">包含隐藏的文件</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>文件夹展示规则</label>
                                <select class="form-control" name="file_view_hidden_folder">
                                    <option value="1" th:selected="${file_view_hidden_folder==null || file_view_hidden_folder=='1'}">展示所有文件夹</option>
                                    <option value="2" th:selected="${file_view_hidden_folder=='2'}">排除空文件夹</option>
                                </select>
                            </div>

                            <div class="form-group">
                                <label >排除小文件，小于配置的大小(MB)则不展示</label>
                                <input type="number" class="form-control" name="file_view_list_min_mb" min="0" max="9999999"
                                       th:value="${(file_view_list_min_mb==null||file_view_list_min_mb=='')?'10':file_view_list_min_mb}" placeholder="">

                            </div>


                            <div class="form-group">
                                <label>默认排序规则</label>
                                <select class="form-control" name="file_view_file_sort">
                                    <option value="1" th:selected="${file_view_file_sort==null || file_view_file_sort=='1'}">文件名排序（顺序）</option>
                                    <option value="2" th:selected="${file_view_file_sort=='2'}">文件创建时间排序（顺序）</option>
                                    <option value="3" th:selected="${file_view_file_sort=='3'}">文件更新时间排序（顺序）</option>
                                    <option value="4" th:selected="${file_view_file_sort=='4'}">文件名排序（倒序）</option>
                                    <option value="5" th:selected="${file_view_file_sort=='5'}">文件创建时间排序（倒序）</option>
                                    <option value="6" th:selected="${file_view_file_sort=='6'}">文件更新时间排序（倒序）</option>
                                </select>
                            </div>



                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="button" onclick="saveFileForm();" class="btn btn-primary">保存配置</button>
                            <button type="button" onclick="window.parent.alertSuccess('待完善！');" class="btn btn-primary">重建索引库</button>
                        </div>
                    </form>
                </div>
                <!-- /.box -->




            </div>
            <!--/.col (left) -->
            <!-- right column -->
            <div class="col-md-6">
                <!-- Horizontal Form -->
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">安全相关配置</h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form id="form_security" onsubmit="return false">
                        <div class="box-body">
                            <!-- Select multiple-->
                            <div class="form-group">
                                <label >系统用户名</label>
                                <input type="text" class="form-control" name="security_system_username"
                                       th:value="${(security_system_username==null||security_system_username=='')?default_user_name:security_system_username }"  placeholder="">
                            </div>

                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="security_is_user" th:checked="${security_is_user=='on'}">使用安全认证
                                </label>
                            </div>
                            <div class="form-group">
                                <label>安全认证的密码</label>
                                <select class="form-control" name="security_password_type" >
                                    <option value="1" th:selected="${security_password_type==null || security_password_type=='1'}">每次启动随机产生（控制台查看）</option>
                                    <option value="2" th:selected="${security_password_type=='2'}">自定义认证密码</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label >安全认证密码</label>
                                <input type="number" class="form-control" name="security_custom_password"
                                       th:value="${(security_custom_password==null||security_custom_password=='')?'123456':security_custom_password}"
                                       placeholder="请输入6位数字认证密码">
                            </div>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="security_is_file_download" th:checked="${security_is_file_download=='on'}">文件下载开启/关闭
                                </label>
                            </div>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="security_save_download_log" th:checked="${security_save_download_log=='on'}"> 记录下载日志审计
                                </label>
                            </div>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="security_is_screen_capture" th:checked="${security_is_screen_capture=='on'}"> 截屏功能开启/禁用
                                </label>
                            </div>
                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="security_is_wake_lan" th:checked="${security_is_wake_lan=='on'}"> 网络唤醒功能开启/禁用
                                </label>
                            </div>

                            <div class="checkbox">
                                <label>
                                    <input type="checkbox" name="security_is_ftp" th:checked="${security_is_ftp=='on'}"> FTP服务功能开启/禁用
                                </label>
                            </div>
                            <div class="form-group">
                                <label >FTP服务使用的端口</label>
                                <input type="number" class="form-control" name="security_ftp_port" th:value="${security_ftp_port==null?'21':security_ftp_port}"  placeholder="">
                            </div>
                            <div class="row">
                                <div class="col-xs-6">
                                    <input type="text" class="form-control" name="security_ftp_username" th:value="${security_ftp_username==null?'admin':security_ftp_username}" placeholder="FTP认证账号">
                                </div>
                                <div class="col-xs-6">
                                    <input type="text" class="form-control" name="security_ftp_password" th:value="${security_ftp_password==null?'123456':security_ftp_password}" placeholder="FTP认证密码">
                                </div>
                            </div>

                            <div class="form-group">
                                <label >FTP默认的目录</label>
                                <input type="text" class="form-control" name="security_ftp_root_dir"
                                       th:value="${(security_ftp_root_dir==null||security_ftp_root_dir=='' )?default_ftp_dir:security_ftp_root_dir}"
                                       placeholder="">
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="button" onclick="saveSecurityForm();" class="btn btn-primary">保存配置</button>
                        </div>
                    </form>
                </div>
                <!-- /.box -->
                <!-- general form elements disabled -->


                <!-- Form Element sizes -->
                <div class="box box-success">
                    <div class="box-header with-border">
                        <h3 class="box-title">日志相关</h3>
                    </div>
                    <form id="form_log" onsubmit="return false">
                        <div class="box-body">
                            <div class="form-group">
                                <label>记录播放文件日志</label>
                                <select class="form-control" name="syslog_play_file_log">
                                    <option value="1" th:selected="${syslog_play_file_log==null || syslog_play_file_log=='1'}">是</option>
                                    <option value="0" th:selected="${syslog_play_file_log=='0'}">否</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>记录删除文件日志</label>
                                <select class="form-control" name="syslog_delete_file_log">
                                    <option value="1" th:selected="${syslog_delete_file_log==null || syslog_delete_file_log=='1'}">是</option>
                                    <option value="0" th:selected="${syslog_delete_file_log=='0'}">否</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>记录命令执行日志</label>
                                <select class="form-control" name="syslog_cmd_exec_log">
                                    <option value="1" th:selected="${syslog_cmd_exec_log==null || syslog_cmd_exec_log=='1'}">是</option>
                                    <option value="0" th:selected="${syslog_cmd_exec_log=='0'}">否</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>记录访问日志</label>
                                <select class="form-control" name="syslog_login_log">
                                    <option value="1" th:selected="${syslog_login_log==null || syslog_login_log=='1'}">是</option>
                                    <option value="0" th:selected="${syslog_login_log=='0'}">否</option>
                                </select>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <button type="button" onclick="saveLogForm();" class="btn btn-primary">保存配置</button>
                        </div>
                    </form>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->

                <!-- /.box -->
            </div>
            <!--/.col (right) -->
        </div>
        <!-- /.row -->

    </section>

    <!-- /.content -->
    <script type="application/javascript">
        //保存安全配置
        function saveSecurityForm(){
            var params = jQuery('#form_security').serialize();
            var urlStr = ctxPath + '/jm/manager/config/saveSecurity';
            jQuery.ajax({
                url: urlStr,
                type: "POST",
                dataType: 'json',//接受数据格式
                data: params,   //要传递的数据
                async: false,
                success: function (data) {
                    if(data.data){
                        window.parent.alertSuccess('保存配置成功！');
                    }else{
                        window.parent.alertError('保存配置失败！');
                    }
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    window.parent.alertError('保存配置异常！');
                }
            });
        }

        //保存日志相关配置
        function saveLogForm(){
            var params = jQuery('#form_log').serialize();
            var urlStr = ctxPath + '/jm/manager/config/saveLogConfig';
            jQuery.ajax({
                url: urlStr,
                type: "POST",
                dataType: 'json',//接受数据格式
                data: params,   //要传递的数据
                async: false,
                success: function (data) {
                    if(data.data){
                        window.parent.alertSuccess('保存配置成功！');
                    }else{
                        window.parent.alertError('保存配置失败！');
                    }
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    window.parent.alertError('保存配置异常！');
                }
            });
        }

        //保存文件相关配置
        function saveFileForm(){
            var params = jQuery('#form_file').serialize();
            var urlStr = ctxPath + '/jm/manager/config/saveFileConfig';
            jQuery.ajax({
                url: urlStr,
                type: "POST",
                dataType: 'json',//接受数据格式
                data: params,   //要传递的数据
                async: false,
                success: function (data) {
                    if(data.data){
                        window.parent.alertSuccess('保存配置成功！');
                    }else{
                        window.parent.alertError('保存配置失败！');
                    }
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    window.parent.alertError('保存配置异常！');
                }
            });
        }
    </script>
</body>
</html>
